package com.tuoyu.peopletest.model.data;

import com.blankj.utilcode.util.EncryptUtils;
import com.blankj.utilcode.util.SPUtils;

/**
 * app公用的参数存储
 */
public class SaveAppData {


    /**
     * 验证码
     */
    public static void setCodeTime(long time) {
        SPUtils.getInstance().put("sc_send_code", time);
    }

    /**
     * 验证码
     *
     * @return
     */
    public static long getCodeTime() {
        return SPUtils.getInstance().getLong("sc_send_code", 0);
    }

    /**
     * 音乐更新时间
     *
     * @param url
     * @return
     */
    public static String getMusicUpDataTime(String url) {

        return SPUtils.getInstance().getString(EncryptUtils.encryptMD5ToString(url));
    }


    public static void setMusicUpDataTime(String url, String time) {
        SPUtils.getInstance().put(EncryptUtils.encryptMD5ToString(url), time);
    }


    private static boolean mIsDevicesConnected = false;

    /**
     * 硬件设备是否链接上了
     *
     * @param isDevicesConnected
     */
    public static void setDevicesConnect(boolean isDevicesConnected) {
        mIsDevicesConnected = isDevicesConnected;
    }

    public static boolean getDevicesIsConnect() {
        return mIsDevicesConnected;
    }

    public static void setDeviceStr(String name) {
        SPUtils.getInstance().put("sc_device_str", name);
    }

    /**
     * 蓝牙地址
     *
     * @return
     */
    public static String getDeviceStr() {
        return SPUtils.getInstance().getString("sc_device_str", "");
    }

    /**
     * 呼吸最大值
     * @param maxAmpBreath
     */
    public static void setBreathTestMax(int maxAmpBreath) {
        SPUtils.getInstance().put("sc_breat_test_max", maxAmpBreath);
    }

    public static int getBreathTestMax() {
       return SPUtils.getInstance().getInt("sc_breat_test_max", 0);
    }

    /**
     * 试剂盒二维码
     * @param scanStr
     */
    public static void setScanResult(String scanStr) {
        SPUtils.getInstance().put("sc_breat_scan_str", scanStr);
    }

    public static String getScanResult() {
        return SPUtils.getInstance().getString("sc_breat_scan_str", "");
    }

    public static void setScanResult02(String scanStr) {
        SPUtils.getInstance().put("sc_breat_scan_str02", scanStr);
    }

    public static String getScanResult02() {
        return SPUtils.getInstance().getString("sc_breat_scan_str02", "");
    }

}
